package com.example.xksys.mapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {
    //#{xxx}其中的内容，是Map集合的key，区分大小写、
    //也就是页面中表单控件中的name属性的值
    @Insert("insert into student(loginName,loginPwd,stuName,stuEmail)" +
            " values(#{loginName},md5(#{loginPwd}),#{stuName},#{stuEmail})")
    int save(Map<String, String> param);
    @Select("select * from student where loginName=#{loginName}")
    List <Map<String,Object> > regsearch(Map<String,String>param);
    @Select("select * from student where (loginName=#{loginName} or stuEmail=#{loginName}) and loginPwd=md5(#{loginPwd})")
    List<Map<String,Object> >  login(Map<String, String> param);

    @Select("select * from student where loginName=#{loginName} and  loginPwd = md5(#{stuOldPwd})")
    List<Map<String,Object> > checkPwd(Map<String,String> param);

    @Update("update  student set loginPwd=md5(#{stuNewPwd}) where loginName = #{loginName} ")
    int updatePwd(Map<String,String> param);
}
